The routines in cdrom.c are designed in such a way that a run-time
configuration of the behavior of CDROM devices (of any type)
can be carried out, by the
CDROMSET/CLEAROPTIONS ioctls. Thus, various
modes of operation can be set:
-
CDOAUTOCLOSE | CDOUSEFFLAGS | CDOLOCK
- This is the default setting. (With
CDOCHECKTYPE it will be better,
in the future.) If the device is not yet opened by any other process,
and it is opened for data (
ONONBLOCK is not set) and the tray is
found open, an attempt to close the tray is made. Then, it is verified
that a disc is in the drive and, if
CDOCHECKTYPE is set, that its
type is `data mode 1.' Only if all tests are passed, the return value
is zero. The door is locked to prevent file system corruption. If
opened for audio (
ONONBLOCK is set), no actions are taken and a
value of 0 will be returned.
- 0
- Open() will always be successful, the option flags are
ignored. Neither actions are undertaken, nor any integrity checks are
made.
-
CDOAUTOCLOSE | CDOAUTOEJECT | CDOLOCK
- This mimics the behavior of the current sbpcd-driver. The option flags
are ignored, the tray is closed on the first open, if
necessary. Similarly, the tray is opened on the last release, i.e., if
a CDROM is unmounted, it is automatically ejected, such that the
user can replace it.
We hope that these option can convince everybody (both driver
maintainers and user program developers) to adapt to the new CDROM driver scheme and option flag interpretation.